<extend name="Public:template" />
<block name="page_header">
	<ul class="header-sub">
		<li class="previous"><a href="{:U('Index/index')}" class="btn btn-default active" role="button"><span class="icon icon-home"></span>首页</a></li>
		<li ><h3>客户登录</h3></li>
		<li class="next "><a href="{:U('CustPassport/showRegist')}" class="btn btn-success active" role="button">注册<span class="icon-white icon-user"></span></a></li>
	</ul>
</block>
<block name="page_body">
<div id="alert_box">
	<div class="alert-sm alert-success" style="display:none"></div>
	<div class="alert-sm alert-danger" style="display:none"></div>
</div>
<form action="{:U('CustPassport/doLogin')}" method="post" id="form_edit" name="form_edit" role="form">
	<input type="hidden" name="lastUrl" value="{$lastUrl}">
	<div class="input-group mt5">
		<span class="input-group-addon alert-warning">帐号</span>
		<input type="tel" class="form-control"  id="cust_account" name="cust_account" placeholder="请输入手机号码">
	</div>
	<div class="input-group  mt5">
		<span class="input-group-addon alert-warning">密码</span>
		<input type="password" class="form-control" id="cust_pass" name="cust_pass" placeholder="请输入密码">
	</div>
	<div class="checkbox mt15">
		<label>
			<input type="checkbox" id="keep_login" name="keep_login" value="1" >记住密码
		</label>
	</div>
	<button type="button" id="doLoginBtn" class="btn btn-warning btn-lg btn-block active mt5">立即登录</button>
	<div>如果您还没有账号，请点击右上角的【注册】按钮！</div>
</form>
</block>
<block name="script_footer">
<script type="text/javascript">
$(document).ready(function(){
	$("#doLoginBtn").on( "click", function(e) {
		$("#alert_box .alert-danger").hide();
		$("#alert_box .alert-success").hide();
		$.ajax({
	        'url': $("#form_edit").attr("action"),
	        'type':"post",
	        'dataType': "json",
	        'data': $('#form_edit').serialize(),
	        'success': function (data) {
	        	var error = data['error'];
	        	var message = data['message'];
	        	if(error=='0'){
	        		$("#alert_box .alert-success").html(message).show;
	        		var lastUrl = document.forms['form_edit'].lastUrl.value;
	        		document.location.href="{:U('jumpLastUrl')}?lastUrl="+lastUrl;
	        	}else{
	        		$("#alert_box .alert-danger").html(message).show();
	        	}
	        }
	    });
	});
})
</script>
</block>